package com.dmgis.qxfw.dataservice.businessservice.common.util;

import org.dom4j.Document;

/**
 * 微信消息公共类
 *
 * @author dsq
 */
public class WeChatMessage {
    public WeChatMessage() {
    }

    public WeChatMessage(Document xmlDoc) {
        String msgType = xmlDoc.selectSingleNode("/xml/MsgType").getText();
        String toUserName = xmlDoc.selectSingleNode("/xml/ToUserName").getText();
        String fromUserName = xmlDoc.selectSingleNode("/xml/FromUserName").getText();
        String createTime = xmlDoc.selectSingleNode("/xml/CreateTime").getText();
        this.setMsgType(msgType);
        this.setToUserName(toUserName);
        this.setFromUserName(fromUserName);
        this.setCreateTime(Integer.parseInt(createTime));
    }

    /**
     * 消息类别
     */
    private String msgType;
    /**
     * 接收方帐号（收到的OpenID）
     */
    private String toUserName;
    /**
     * 开发者微信号
     */
    private String fromUserName;
    /**
     * 消息创建时间 （整型）
     */
    private Integer createTime;

    //    /**
//     * 消息内容
//     */
//    private  Document xmldoc;
    public String getMsgType() {
        return msgType;
    }

    public void setMsgType(String msgType) {
        this.msgType = msgType;
    }

    public String getToUserName() {
        return toUserName;
    }

    public void setToUserName(String toUserName) {
        this.toUserName = toUserName;
    }

    public String getFromUserName() {
        return fromUserName;
    }

    public void setFromUserName(String fromUserName) {
        this.fromUserName = fromUserName;
    }

    public Integer getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Integer createTime) {
        this.createTime = createTime;
    }

//    public Document getXmldoc() {
//        return xmldoc;
//    }
//
//    public void setXmldoc(Document xmldoc) {
//        this.xmldoc = xmldoc;
//    }

}
